<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="this.bannerImg"/>
      <div class="banner-info">
        <div class="banner-title">{{this.sightName}}</div>
        <div class="banner-num"><span class="iconfont banner-icon">&#xe700;</span> 88</div>
      </div>
    </div>
    <CommonFade>
      <CommonGallary :imgs="this.gallaryImgs" v-show="showGallary" @closeGallary="handleGallaryClose"></CommonGallary>
    </CommonFade>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import CommonFade from 'common/fade/Fade'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  components: {
    CommonGallary,
    CommonFade
  },
  data () {
    return {
      showGallary: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallaryClose () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    overflow:hidden
    position: relative
    height: 0
    width: 100%
    padding-bottom: 55%
    .banner-img
      width: 100%
    .banner-info
      position: absolute
      display: flex
      bottom: 0
      left: 0
      right: 0
      color: white
      background-image: linear-gradient(top,rgba(0, 0, 0, 0), rgba(0, 0, 0, 8))
      line-height: .6rem
      .banner-title
        flex:1
        font-size: .4rem
        padding-left: .2rem
      .banner-num
        padding: 0 .4rem
        height: .4rem
        line-height: .4rem
        border-radius: .2rem
        font-size: .24rem
        background: rgba(0, 0, 0, 8) // 背景透明度
</style>
